/*     */ package blockbuster.components.appearance;
/*     */ import blockbuster.emitter.BedrockEmitter;
/*     */ import blockbuster.emitter.BedrockParticle;
/*     */ import blockbuster.math.molang.MolangException;
/*     */ import blockbuster.math.molang.MolangParser;
/*     */ import blockbuster.math.molang.expressions.MolangExpression;
/*     */ import blockbuster.utils.Interpolations;
/*     */ import com.google.gson.JsonArray;
/*     */ import com.google.gson.JsonElement;
/*     */ import com.google.gson.JsonObject;
/*     */ import javax.vecmath.Matrix3d;
/*     */ import javax.vecmath.Matrix4d;
/*     */ import javax.vecmath.Matrix4f;
/*     */ import javax.vecmath.Tuple3d;
/*     */ import javax.vecmath.Tuple4f;
/*     */ import javax.vecmath.Vector3d;
/*     */ import javax.vecmath.Vector3f;
/*     */ import javax.vecmath.Vector4f;
/*     */ import net.minecraft.client.renderer.BufferBuilder;
/*     */ import net.minecraft.client.renderer.Tessellator;
/*     */ import net.minecraft.util.math.MathHelper;
/*     */ 
/*     */ public class BedrockComponentAppearanceBillboard extends BedrockComponentBase implements IComponentParticleRender {
/*  24 */   public MolangExpression sizeW = MolangParser.ZERO;
/*  25 */   public MolangExpression sizeH = MolangParser.ZERO;
/*  26 */   public CameraFacing facing = CameraFacing.LOOKAT_XYZ;
/*  27 */   public int textureWidth = 128;
/*  28 */   public int textureHeight = 128;
/*  29 */   public MolangExpression uvX = MolangParser.ZERO;
/*  30 */   public MolangExpression uvY = MolangParser.ZERO;
/*  31 */   public MolangExpression uvW = MolangParser.ZERO;
/*  32 */   public MolangExpression uvH = MolangParser.ZERO;
/*     */   
/*     */   public boolean flipbook = false;
/*     */   public float stepX;
/*     */   public float stepY;
/*     */   public float fps;
/*  38 */   public MolangExpression maxFrame = MolangParser.ZERO;
/*     */   
/*     */   public boolean stretchFPS = false;
/*     */   
/*     */   public boolean loop = false;
/*     */   
/*     */   protected float w;
/*     */   
/*     */   protected float h;
/*     */   protected float u1;
/*     */   protected float v1;
/*     */   protected float u2;
/*     */   protected float v2;
/*  51 */   protected Matrix4f transform = new Matrix4f();
/*  52 */   protected Matrix4f rotation = new Matrix4f();
/*  53 */   protected Vector4f[] vertices = new Vector4f[] { new Vector4f(0.0F, 0.0F, 0.0F, 1.0F), new Vector4f(0.0F, 0.0F, 0.0F, 1.0F), new Vector4f(0.0F, 0.0F, 0.0F, 1.0F), new Vector4f(0.0F, 0.0F, 0.0F, 1.0F) };
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*  59 */   protected Vector3f vector = new Vector3f();
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */   
/*     */   public BedrockComponentBase fromJson(JsonElement elem, MolangParser parser) throws MolangException {
/*  66 */     if (!elem.isJsonObject()) return super.fromJson(elem, parser);
/*     */     
/*  68 */     JsonObject element = elem.getAsJsonObject();
/*     */     
/*  70 */     if (element.has("size") && element.get("size").isJsonArray()) {
/*  71 */       JsonArray size = element.getAsJsonArray("size");
/*     */       
/*  73 */       if (size.size() >= 2) {
/*  74 */         this.sizeW = parser.parseJson(size.get(0));
/*  75 */         this.sizeH = parser.parseJson(size.get(1));
/*     */       } 
/*     */     } 
/*     */     
/*  79 */     if (element.has("facing_camera_mode")) {
/*  80 */       this.facing = CameraFacing.fromString(element.get("facing_camera_mode").getAsString());
/*     */     }
/*     */     
/*  83 */     if (element.has("uv") && element.get("uv").isJsonObject()) {
/*  84 */       parseUv(element.get("uv").getAsJsonObject(), parser);
/*     */     }
/*     */     
/*  87 */     return super.fromJson((JsonElement)element, parser);
/*     */   }
/*     */   
/*     */   protected void parseUv(JsonObject object, MolangParser parser) throws MolangException {
/*  91 */     if (object.has("texture_width")) this.textureWidth = object.get("texture_width").getAsInt(); 
/*  92 */     if (object.has("texture_height")) this.textureHeight = object.get("texture_height").getAsInt();
/*     */     
/*  94 */     if (object.has("uv") && object.get("uv").isJsonArray()) {
/*  95 */       JsonArray uv = object.getAsJsonArray("uv");
/*     */       
/*  97 */       if (uv.size() >= 2) {
/*  98 */         this.uvX = parser.parseJson(uv.get(0));
/*  99 */         this.uvY = parser.parseJson(uv.get(1));
/*     */       } 
/*     */     } 
/*     */     
/* 103 */     if (object.has("uv_size") && object.get("uv_size").isJsonArray()) {
/* 104 */       JsonArray uv = object.getAsJsonArray("uv_size");
/*     */       
/* 106 */       if (uv.size() >= 2) {
/* 107 */         this.uvW = parser.parseJson(uv.get(0));
/* 108 */         this.uvH = parser.parseJson(uv.get(1));
/*     */       } 
/*     */     } 
/*     */     
/* 112 */     if (object.has("flipbook") && object.get("flipbook").isJsonObject()) {
/* 113 */       this.flipbook = true;
/* 114 */       parseFlipbook(object.get("flipbook").getAsJsonObject(), parser);
/*     */     } 
/*     */   }
/*     */   
/*     */   protected void parseFlipbook(JsonObject flipbook, MolangParser parser) throws MolangException {
/* 119 */     if (flipbook.has("base_UV") && flipbook.get("base_UV").isJsonArray()) {
/* 120 */       JsonArray uv = flipbook.getAsJsonArray("base_UV");
/*     */       
/* 122 */       if (uv.size() >= 2) {
/* 123 */         this.uvX = parser.parseJson(uv.get(0));
/* 124 */         this.uvY = parser.parseJson(uv.get(1));
/*     */       } 
/*     */     } 
/*     */     
/* 128 */     if (flipbook.has("size_UV") && flipbook.get("size_UV").isJsonArray()) {
/* 129 */       JsonArray uv = flipbook.getAsJsonArray("size_UV");
/*     */       
/* 131 */       if (uv.size() >= 2) {
/* 132 */         this.uvW = parser.parseJson(uv.get(0));
/* 133 */         this.uvH = parser.parseJson(uv.get(1));
/*     */       } 
/*     */     } 
/*     */     
/* 137 */     if (flipbook.has("step_UV") && flipbook.get("step_UV").isJsonArray()) {
/* 138 */       JsonArray uv = flipbook.getAsJsonArray("step_UV");
/*     */       
/* 140 */       if (uv.size() >= 2) {
/* 141 */         this.stepX = uv.get(0).getAsFloat();
/* 142 */         this.stepY = uv.get(1).getAsFloat();
/*     */       } 
/*     */     } 
/*     */     
/* 146 */     if (flipbook.has("frames_per_second")) this.fps = flipbook.get("frames_per_second").getAsFloat(); 
/* 147 */     if (flipbook.has("max_frame")) this.maxFrame = parser.parseJson(flipbook.get("max_frame")); 
/* 148 */     if (flipbook.has("stretch_to_lifetime")) this.stretchFPS = flipbook.get("stretch_to_lifetime").getAsBoolean(); 
/* 149 */     if (flipbook.has("loop")) this.loop = flipbook.get("loop").getAsBoolean();
/*     */   
/*     */   }
/*     */   
/*     */   public JsonElement toJson() {
/* 154 */     JsonObject object = new JsonObject();
/* 155 */     JsonArray size = new JsonArray();
/* 156 */     JsonObject uv = new JsonObject();
/*     */     
/* 158 */     size.add(this.sizeW.toJson());
/* 159 */     size.add(this.sizeH.toJson());
/*     */ 
/*     */     
/* 162 */     uv.addProperty("texture_width", Integer.valueOf(this.textureWidth));
/* 163 */     uv.addProperty("texture_height", Integer.valueOf(this.textureHeight));
/*     */     
/* 165 */     if ((!this.flipbook && !MolangExpression.isZero(this.uvX)) || !MolangExpression.isZero(this.uvY)) {
/* 166 */       JsonArray uvs = new JsonArray();
/* 167 */       uvs.add(this.uvX.toJson());
/* 168 */       uvs.add(this.uvY.toJson());
/*     */       
/* 170 */       uv.add("uv", (JsonElement)uvs);
/*     */     } 
/*     */     
/* 173 */     if ((!this.flipbook && !MolangExpression.isZero(this.uvW)) || !MolangExpression.isZero(this.uvH)) {
/* 174 */       JsonArray uvs = new JsonArray();
/* 175 */       uvs.add(this.uvW.toJson());
/* 176 */       uvs.add(this.uvH.toJson());
/*     */       
/* 178 */       uv.add("uv_size", (JsonElement)uvs);
/*     */     } 
/*     */ 
/*     */     
/* 182 */     if (this.flipbook) {
/* 183 */       JsonObject flipbook = new JsonObject();
/*     */       
/* 185 */       if (!MolangExpression.isZero(this.uvX) || !MolangExpression.isZero(this.uvY)) {
/* 186 */         JsonArray base = new JsonArray();
/* 187 */         base.add(this.uvX.toJson());
/* 188 */         base.add(this.uvY.toJson());
/*     */         
/* 190 */         flipbook.add("base_UV", (JsonElement)base);
/*     */       } 
/*     */       
/* 193 */       if (!MolangExpression.isZero(this.uvW) || !MolangExpression.isZero(this.uvH)) {
/* 194 */         JsonArray uvSize = new JsonArray();
/* 195 */         uvSize.add(this.uvW.toJson());
/* 196 */         uvSize.add(this.uvH.toJson());
/*     */         
/* 198 */         flipbook.add("size_UV", (JsonElement)uvSize);
/*     */       } 
/*     */       
/* 201 */       if (this.stepX != 0.0F || this.stepY != 0.0F) {
/* 202 */         JsonArray step = new JsonArray();
/* 203 */         step.add(Float.valueOf(this.stepX));
/* 204 */         step.add(Float.valueOf(this.stepY));
/*     */         
/* 206 */         flipbook.add("step_UV", (JsonElement)step);
/*     */       } 
/*     */       
/* 209 */       if (this.fps != 0.0F) flipbook.addProperty("frames_per_second", Float.valueOf(this.fps)); 
/* 210 */       if (!MolangExpression.isZero(this.maxFrame)) flipbook.add("max_frame", this.maxFrame.toJson()); 
/* 211 */       if (this.stretchFPS) flipbook.addProperty("stretch_to_lifetime", Boolean.valueOf(true)); 
/* 212 */       if (this.loop) flipbook.addProperty("loop", Boolean.valueOf(true));
/*     */       
/* 214 */       uv.add("flipbook", (JsonElement)flipbook);
/*     */     } 
/*     */ 
/*     */     
/* 218 */     object.add("size", (JsonElement)size);
/* 219 */     object.addProperty("facing_camera_mode", this.facing.id);
/* 220 */     object.add("uv", (JsonElement)uv);
/*     */     
/* 222 */     return (JsonElement)object;
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   public void preRender(BedrockEmitter emitter, float partialTicks) {}
/*     */ 
/*     */   
/*     */   public void render(BedrockEmitter emitter, BedrockParticle particle, BufferBuilder builder, float partialTicks) {
/* 231 */     calculateUVs(particle, partialTicks);
/*     */ 
/*     */     
/* 234 */     double px = Interpolations.lerp(particle.prevPosition.x, particle.position.x, partialTicks);
/* 235 */     double py = Interpolations.lerp(particle.prevPosition.y, particle.position.y, partialTicks);
/* 236 */     double pz = Interpolations.lerp(particle.prevPosition.z, particle.position.z, partialTicks);
/* 237 */     float angle = Interpolations.lerp(particle.prevRotation, particle.rotation, partialTicks);
/*     */     
/* 239 */     Vector3d pos = calculatePosition(emitter, particle, px, py, pz);
/* 240 */     px = pos.x;
/* 241 */     py = pos.y;
/* 242 */     pz = pos.z;
/*     */ 
/*     */     
/* 245 */     int light = emitter.getBrightnessForRender(partialTicks, px, py, pz);
/* 246 */     int lightX = light >> 16 & 0xFFFF;
/* 247 */     int lightY = light & 0xFFFF;
/*     */     
/* 249 */     calculateFacing(emitter, particle, px, py, pz);
/*     */     
/* 251 */     this.rotation.rotZ(angle / 180.0F * 3.1415927F);
/* 252 */     this.transform.mul(this.rotation);
/* 253 */     this.transform.setTranslation(new Vector3f((float)px, (float)py, (float)pz));
/*     */     
/* 255 */     for (Vector4f vertex : this.vertices) {
/* 256 */       this.transform.transform((Tuple4f)vertex);
/*     */     }
/*     */     
/* 259 */     float u1 = this.u1 / this.textureWidth;
/* 260 */     float u2 = this.u2 / this.textureWidth;
/* 261 */     float v1 = this.v1 / this.textureHeight;
/* 262 */     float v2 = this.v2 / this.textureHeight;
/*     */     
/* 264 */     builder.func_181662_b((this.vertices[0]).x, (this.vertices[0]).y, (this.vertices[0]).z).func_187315_a(u1, v1).func_187314_a(lightX, lightY).func_181666_a(particle.r, particle.g, particle.b, particle.a).func_181675_d();
/* 265 */     builder.func_181662_b((this.vertices[1]).x, (this.vertices[1]).y, (this.vertices[1]).z).func_187315_a(u2, v1).func_187314_a(lightX, lightY).func_181666_a(particle.r, particle.g, particle.b, particle.a).func_181675_d();
/* 266 */     builder.func_181662_b((this.vertices[2]).x, (this.vertices[2]).y, (this.vertices[2]).z).func_187315_a(u2, v2).func_187314_a(lightX, lightY).func_181666_a(particle.r, particle.g, particle.b, particle.a).func_181675_d();
/* 267 */     builder.func_181662_b((this.vertices[3]).x, (this.vertices[3]).y, (this.vertices[3]).z).func_187315_a(u1, v2).func_187314_a(lightX, lightY).func_181666_a(particle.r, particle.g, particle.b, particle.a).func_181675_d();
/*     */   }
/*     */ 
/*     */ 
/*     */   
/*     */   protected void calculateFacing(BedrockEmitter emitter, BedrockParticle particle, double px, double py, double pz) {
/* 273 */     float entityYaw = emitter.cYaw;
/* 274 */     float entityPitch = emitter.cPitch;
/* 275 */     double entityX = emitter.cX;
/* 276 */     double entityY = emitter.cY;
/* 277 */     double entityZ = emitter.cZ;
/* 278 */     boolean lookAt = (this.facing == CameraFacing.LOOKAT_XYZ || this.facing == CameraFacing.LOOKAT_Y);
/*     */ 
/*     */     
/* 281 */     if (emitter.perspective == 2) {
/* 282 */       this.w = -this.w;
/*     */     
/*     */     }
/* 285 */     else if (emitter.perspective == 100 && !lookAt) {
/* 286 */       entityYaw = 180.0F - entityYaw;
/*     */       
/* 288 */       this.w = -this.w;
/* 289 */       this.h = -this.h;
/*     */     } 
/*     */     
/* 292 */     if (lookAt) {
/* 293 */       double dX = entityX - px;
/* 294 */       double dY = entityY - py;
/* 295 */       double dZ = entityZ - pz;
/* 296 */       double horizontalDistance = MathHelper.func_76133_a(dX * dX + dZ * dZ);
/*     */       
/* 298 */       entityYaw = 180.0F - (float)(MathHelper.func_181159_b(dZ, dX) * 57.29577951308232D) - 90.0F;
/* 299 */       entityPitch = (float)-(MathHelper.func_181159_b(dY, horizontalDistance) * 57.29577951308232D) + 180.0F;
/*     */     } 
/*     */     
/* 302 */     calculateVertices(emitter, particle);
/*     */     
/* 304 */     if (this.facing == CameraFacing.ROTATE_XYZ || this.facing == CameraFacing.LOOKAT_XYZ) {
/* 305 */       this.rotation.rotY(entityYaw / 180.0F * 3.1415927F);
/* 306 */       this.transform.mul(this.rotation);
/* 307 */       this.rotation.rotX(entityPitch / 180.0F * 3.1415927F);
/* 308 */       this.transform.mul(this.rotation);
/* 309 */     } else if (this.facing == CameraFacing.ROTATE_Y || this.facing == CameraFacing.LOOKAT_Y) {
/* 310 */       this.rotation.rotY(entityYaw / 180.0F * 3.1415927F);
/* 311 */       this.transform.mul(this.rotation);
/* 312 */     } else if (this.facing == CameraFacing.EMITTER_YZ) {
/* 313 */       this.rotation.rotZ((float)Math.toRadians(180.0D));
/* 314 */       this.transform.mul(this.rotation);
/* 315 */       this.rotation.rotY((float)Math.toRadians(90.0D));
/* 316 */       this.transform.mul(this.rotation);
/* 317 */     } else if (this.facing == CameraFacing.EMITTER_XZ) {
/* 318 */       this.rotation.rotX((float)Math.toRadians(90.0D));
/* 319 */       this.transform.mul(this.rotation);
/* 320 */     } else if (this.facing == CameraFacing.EMITTER_XY) {
/* 321 */       this.rotation.rotX((float)Math.toRadians(180.0D));
/* 322 */       this.transform.mul(this.rotation);
/*     */     } 
/*     */   }
/*     */   
/*     */   protected void calculateVertices(BedrockEmitter emitter, BedrockParticle particle) {
/* 327 */     this.vertices[0].set(-this.w / 2.0F, -this.h / 2.0F, 0.0F, 1.0F);
/* 328 */     this.vertices[1].set(this.w / 2.0F, -this.h / 2.0F, 0.0F, 1.0F);
/* 329 */     this.vertices[2].set(this.w / 2.0F, this.h / 2.0F, 0.0F, 1.0F);
/* 330 */     this.vertices[3].set(-this.w / 2.0F, this.h / 2.0F, 0.0F, 1.0F);
/* 331 */     this.transform.setIdentity();
/*     */     
/* 333 */     if (particle.relativeScaleBillboard) {
/* 334 */       Matrix4d scale = new Matrix4d(emitter.scale[0], 0.0D, 0.0D, 0.0D, 0.0D, emitter.scale[1], 0.0D, 0.0D, 0.0D, 0.0D, emitter.scale[2], 0.0D, 0.0D, 0.0D, 0.0D, 1.0D);
/*     */ 
/*     */ 
/*     */ 
/*     */       
/* 339 */       for (Vector4f vertex : this.vertices) {
/* 340 */         scale.transform((Tuple4f)vertex);
/*     */       }
/*     */     } 
/*     */   }
/*     */   
/*     */   protected Vector3d calculatePosition(BedrockEmitter emitter, BedrockParticle particle, double px, double py, double pz) {
/* 346 */     if (particle.relativePosition && particle.relativeRotation) {
/* 347 */       this.vector.set((float)px, (float)py, (float)pz);
/*     */       
/* 349 */       if (particle.relativeScale) {
/* 350 */         Vector3d pos = new Vector3d(px, py, pz);
/*     */         
/* 352 */         Matrix3d scale = new Matrix3d(emitter.scale[0], 0.0D, 0.0D, 0.0D, emitter.scale[1], 0.0D, 0.0D, 0.0D, emitter.scale[2]);
/*     */ 
/*     */ 
/*     */         
/* 356 */         scale.transform((Tuple3d)pos);
/*     */         
/* 358 */         this.vector.x = (float)pos.x;
/* 359 */         this.vector.y = (float)pos.y;
/* 360 */         this.vector.z = (float)pos.z;
/*     */       } 
/*     */       
/* 363 */       emitter.rotation.transform((Tuple3f)this.vector);
/*     */       
/* 365 */       px = this.vector.x;
/* 366 */       py = this.vector.y;
/* 367 */       pz = this.vector.z;
/*     */       
/* 369 */       px += emitter.lastGlobal.x;
/* 370 */       py += emitter.lastGlobal.y;
/* 371 */       pz += emitter.lastGlobal.z;
/* 372 */     } else if (particle.relativeScale) {
/* 373 */       Vector3d pos = new Vector3d(px, py, pz);
/*     */       
/* 375 */       Matrix3d scale = new Matrix3d(emitter.scale[0], 0.0D, 0.0D, 0.0D, emitter.scale[1], 0.0D, 0.0D, 0.0D, emitter.scale[2]);
/*     */ 
/*     */ 
/*     */       
/* 379 */       pos.sub((Tuple3d)emitter.lastGlobal);
/* 380 */       scale.transform((Tuple3d)pos);
/* 381 */       pos.add((Tuple3d)emitter.lastGlobal);
/*     */       
/* 383 */       px = pos.x;
/* 384 */       py = pos.y;
/* 385 */       pz = pos.z;
/*     */     } 
/*     */     
/* 388 */     return new Vector3d(px, py, pz);
/*     */   }
/*     */ 
/*     */   
/*     */   public void renderOnScreen(BedrockParticle particle, int x, int y, float scale, float partialTicks) {
/* 393 */     calculateUVs(particle, partialTicks);
/*     */     
/* 395 */     this.w = this.h = 0.5F;
/* 396 */     float angle = Interpolations.lerp(particle.prevRotation, particle.rotation, partialTicks);
/*     */ 
/*     */     
/* 399 */     this.vertices[0].set(-this.w / 2.0F, -this.h / 2.0F, 0.0F, 1.0F);
/* 400 */     this.vertices[1].set(this.w / 2.0F, -this.h / 2.0F, 0.0F, 1.0F);
/* 401 */     this.vertices[2].set(this.w / 2.0F, this.h / 2.0F, 0.0F, 1.0F);
/* 402 */     this.vertices[3].set(-this.w / 2.0F, this.h / 2.0F, 0.0F, 1.0F);
/* 403 */     this.transform.setIdentity();
/* 404 */     this.transform.setScale(scale * 2.75F);
/* 405 */     this.transform.setTranslation(new Vector3f(x, y - scale / 2.0F, 0.0F));
/*     */     
/* 407 */     this.rotation.rotZ(angle / 180.0F * 3.1415927F);
/* 408 */     this.transform.mul(this.rotation);
/*     */     
/* 410 */     for (Vector4f vertex : this.vertices) {
/* 411 */       this.transform.transform((Tuple4f)vertex);
/*     */     }
/*     */     
/* 414 */     float u1 = this.u1 / this.textureWidth;
/* 415 */     float u2 = this.u2 / this.textureWidth;
/* 416 */     float v1 = this.v1 / this.textureHeight;
/* 417 */     float v2 = this.v2 / this.textureHeight;
/*     */     
/* 419 */     BufferBuilder builder = Tessellator.func_178181_a().func_178180_c();
/*     */     
/* 421 */     builder.func_181668_a(7, DefaultVertexFormats.field_181709_i);
/* 422 */     builder.func_181662_b((this.vertices[0]).x, (this.vertices[0]).y, (this.vertices[0]).z).func_187315_a(u1, v1).func_181666_a(particle.r, particle.g, particle.b, particle.a).func_181675_d();
/* 423 */     builder.func_181662_b((this.vertices[1]).x, (this.vertices[1]).y, (this.vertices[1]).z).func_187315_a(u2, v1).func_181666_a(particle.r, particle.g, particle.b, particle.a).func_181675_d();
/* 424 */     builder.func_181662_b((this.vertices[2]).x, (this.vertices[2]).y, (this.vertices[2]).z).func_187315_a(u2, v2).func_181666_a(particle.r, particle.g, particle.b, particle.a).func_181675_d();
/* 425 */     builder.func_181662_b((this.vertices[3]).x, (this.vertices[3]).y, (this.vertices[3]).z).func_187315_a(u1, v2).func_181666_a(particle.r, particle.g, particle.b, particle.a).func_181675_d();
/*     */     
/* 427 */     Tessellator.func_178181_a().func_78381_a();
/*     */   }
/*     */ 
/*     */   
/*     */   public void calculateUVs(BedrockParticle particle, float partialTicks) {
/* 432 */     this.w = (float)this.sizeW.get() * 2.25F;
/* 433 */     this.h = (float)this.sizeH.get() * 2.25F;
/*     */     
/* 435 */     float u = (float)this.uvX.get();
/* 436 */     float v = (float)this.uvY.get();
/* 437 */     float w = (float)this.uvW.get();
/* 438 */     float h = (float)this.uvH.get();
/*     */     
/* 440 */     if (this.flipbook) {
/* 441 */       int index = (int)(particle.getAge(partialTicks) * this.fps);
/* 442 */       int max = (int)this.maxFrame.get();
/*     */       
/* 444 */       if (this.stretchFPS) {
/* 445 */         float lifetime = (particle.lifetime <= 0) ? 0.0F : ((particle.age + partialTicks) / particle.lifetime);
/*     */ 
/*     */         
/* 448 */         if (particle.getExpireAge() != -1) {
/* 449 */           lifetime = (particle.lifetime <= 0) ? 0.0F : ((particle.age + partialTicks) / particle.getExpirationDelay());
/*     */         }
/*     */         
/* 452 */         index = (int)(lifetime * max);
/*     */       } 
/*     */       
/* 455 */       if (this.loop && max != 0) {
/* 456 */         index %= max;
/*     */       }
/*     */       
/* 459 */       if (index > max) {
/* 460 */         index = max;
/*     */       }
/*     */       
/* 463 */       u += this.stepX * index;
/* 464 */       v += this.stepY * index;
/*     */     } 
/*     */     
/* 467 */     this.u1 = u;
/* 468 */     this.v1 = v;
/* 469 */     this.u2 = u + w;
/* 470 */     this.v2 = v + h;
/*     */   }
/*     */   
/*     */   public void postRender(BedrockEmitter emitter, float partialTicks) {}
/*     */ }


/* Location:              D:\fanbian\[D][龙之核心]DragonCore-2.6.0.3.jar!\blockbuster\components\appearance\BedrockComponentAppearanceBillboard.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */